import React from 'react'
import { Button, Table, message } from 'antd';

export default function PublishTable(props) {
  const columns = [
    {
      title: '新闻标题',
      dataIndex: 'title',
      key: 'title',
      render: (title, item) => <a href={`#/news-manage/preview/${item.id}`}>{title}</a>
    },
    {
      title: '作者',
      dataIndex: 'author',
      key: 'author',
    },
    {
      title: '新闻分类',
      dataIndex: 'category',
      render: (item) => item.title
    },
    {
      title: '操作',
      render: (item) => {
        return <div>
          {props.button(item)}
        </div>
      }
    },
  ];

  return (
    <div>
      <Table dataSource={props.dataSource} columns={columns} rowKey={item => item.id} pagination={{ pageSize: 5 }} />;
    </div>
  )
}
